<?php

declare(strict_types=1);

namespace app\model\admin;

use app\model\AdminBaseModel;
use think\Model;

/**
 * @mixin \think\Model
 * 协议表
 */
class Refund extends AdminBaseModel
{
    // 数据表名称
    protected $table = 'user_refund';
    protected $scopeField = true;

    //可搜索字段
    protected $searchField = [];
    // like
    protected $singleSearchField = [];
    //可作为条件的字段
    protected $whereField = ['refund_type', 'order_sn'];
    //可做为时间范围查询的字段
    protected $timeField = ['created_at'];

    public function orderItem()
    {
        return $this->belongsTo(OrderItem::class, 'order_item_id', 'id');
    }
    public function order()
    {
        return $this->belongsTo(Order::class, 'order_id', 'id');
    }
    public function user()
    {
        return $this->belongsTo(MiniUser::class, 'user_id', 'id');
    }
}
